<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <h2 id="title"></h2>
  <button id="button">改变文本</button>


  <script>
    const button = document.querySelector("#button")
    const title = document.querySelector("#title")

    let message = "Hello World"
    title.innerHTML = message

    button.onclick = () => {
      let message = "Hello React"
      title.innerHTML = message
    }
  </script>
</body>

</html>